package cn.tedu.spring.example;

import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;


public class TestUser {
    public static void main(String[] args) {
        /*
            1.创建IoC容器:Spring Framework会将创建的Spring Bean对象放入IOC容器中;
         */
        ApplicationContext context = new
                AnnotationConfigApplicationContext("cn.tedu.spring.example");
        /*
            2.获取Bean对象:从IoC容器中获取SpringFramework创建好的对象;
         */
        User user = context.getBean(User.class);
        System.out.println("user="+user);
        /*
           3.调用方法测试:
         */
        user.run();

    }
}
